package school;

public class Student {
	public String stdname;
	public Lab[] lab;
	public double money;

	
	public Student(String name,Lab[] lab,double money) {
		this.stdname = name;
		this.lab = lab;
		this.money = money;
	}
	
	public double getmoney() {
		return money;
	}
	
	public double losemoney(double money) {
		this.money -= money;
		return money;
		}
    
	public double earnmoney(double money) {
        this.money += money;
        return money;
    }
	
	public Lab[] setlaboratory(int N, Lab[] lab, Lab lab1) {
        this.lab[N] = lab1;
        return lab;
    }
	
    public Lab[] getlaboratory() {
        return lab;
    }
        
	public void WorkStudyIncome(String[] List1, Student student) {
		try {
			for (int t = 0; t < 18; t++) {
				if (List1[t] == "youxiu") {
					student.earnmoney(500);
				}
				if (List1[t] == "tongguo") {
				    student.earnmoney(200);
				}
				if (List1[t] == "buhao") {
				 	student.earnmoney(0);
				}
				if (List1[t] == "youxiu" || List1[t] == "tongguo" || List1[t] == "buhao") {
					continue;
				}
			}
		}catch (Exception e) {
			System.out.println("ERROR!");
		}
	}
}
